var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  AdornEquipmentView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.onLoadWeaponryData = {
          caller: t,
          code: 1056,
          method: function (e) {
            var n = e.list;
            n.length > 0
              ? (t.lbl_empty_adorn.visible = !1)
              : ((t.lbl_empty_adorn.text = "暂时没有该装备"),
                (t.lbl_empty_adorn.visible = !0));
            for (var o, r = [], i = 0; i < n.length; i++)
              (o = {
                adornName: { text: n[i].name },
                adornButton: { label: "佩戴" },
                adornID: n[i].id,
              }),
                r.push(o);
            (t.list_adorn.array = r), (t.dataArr = r);
          },
        }),
        (t.onLoadChuangDaiData = {
          caller: t,
          code: 1137,
          method: function (e) {
            0 != e.code && ToastView.toastView(e.msg), t.close();
          },
        }),
        WebSocketService.addListener(t.onLoadWeaponryData),
        WebSocketService.addListener(t.onLoadChuangDaiData, !0),
        (t.list_adorn.vScrollBarSkin = ""),
        (t.list_adorn.selectEnable = !0),
        t.list_adorn.on(Laya.Event.CLICK, t, t.onAdornWeaporyDidClick),
        (t.list_adorn.renderHandler = new Laya.Handler(t, t.updateAdornItem)),
        t.btn_adornCancle.on(Laya.Event.CLICK, t, t.close),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showEquipmentView = function (e) {
        null == this.equipmentView &&
          ((this.equipmentView = new t()), (this.equipmentView.zOrder = 1e3)),
          this.equipmentView.popup(!0),
          (this.equipmentView.lbl_adorn_title.text =
            Utils.transform(e, "equipType") + "列表"),
          WebSocketService.send({ c: 1056, d: { type: e, pageNum: 0 } });
      }),
      (t.prototype.onAdornWeaporyDidClick = function (e) {
        "" != e.target.name &&
          "adornButton" == e.target.name &&
          WebSocketService.send({
            c: 1137,
            d: { id: this.list_adorn.selectedItem.adornID },
          });
      }),
      (t.prototype.updateAdornItem = function (e, t) {
        if (!(t > this.list_adorn.array.length)) {
          e.getChildByName("adornButton").skin =
            "comp/commonpic/btn_dialog_sure.png";
        }
      }),
      (t.close = function () {
        this.equipmentView && this.equipmentView.close();
      }),
      t
    );
  })(ui.UserInfoController.AdornEquipmentViewUI);
